<template>
  <div class="user-login" style="height: 2000px">
    <van-uploader
      v-model="fileList"
      :show-upload="showUpload"
      :after-read="afterRead"
      @delete="afterDelete"
    />
    <van-dropdown-menu>
      <van-dropdown-item
        @change="changeLanguage"
        v-model="value"
        :options="option"
      />
    </van-dropdown-menu>
    <p>{{ $t('message.hello', { msg: 'hello' }) }}</p>
    <div v-highlight="'red'">测试自定义指令</div>
  </div>
</template>
<script lang="ts">
// 合成api
import { useUploadEffect } from '@/effects/uploadEffect'
import { useLanguageEffect } from '@/effects/changeLanguageEfffect'
// import { axios } from '@/utils/request'
import axios from 'axios'
export default {
  setup() {
    const { fileList, showUpload, afterRead, afterDelete } = useUploadEffect()
    const { changeLanguage, option, value } = useLanguageEffect()

    axios
      .post(
        'http://localhost:3000/api/test',
        { a: 1 },
        {
          headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
          }
        }
      )
      .then((res) => {
        console.log('reS:', res)
      })

    // axios({
    //   url: 'http://localhost:3000/api/test',
    //   method: 'get',
    //   params: {
    //     a: 1
    //   }
    // }).then((res: any) => {
    //   console.log(res, 'res')
    // })

    return {
      option,
      value,
      fileList,
      showUpload,
      afterRead,
      afterDelete,
      changeLanguage
    }
  }
}
</script>
